package vector;

public class Vector2Int
{
	public int x;
	public int y;
	
	public Vector2Int(int _x,int _y)
	{
		x =_x;
		y =_y;
	}
	public Vector2Int(Vector2Int v)
	{
		x=v.x;
		y=v.y;
	}
	public Vector2Int(Vector2 v)
	{
		x =(int)v.x;
		y =(int)v.y;
	}
	
	public Vector2Int add(Vector2Int v)
	{
		return new Vector2Int(x+v.x,y+v.y);
	}
	public Vector2Int subtract(Vector2Int v)
	{
		return new Vector2Int(x-v.x,y-v.y);
	}
	public Vector2Int multiply(int number)
	{
		return new Vector2Int(x*number,y*number);
	}
	public Vector2Int divise(int number)
	{
		if(number == 0)
		{
			throw new java.lang.ArithmeticException();
		}
		return new Vector2Int(x/number, y/number);
	}
	
	public int sqrmagnitude()
	{
		return x*x + y*y;
	}
	public double magnitude()
	{
		return Math.sqrt(x*x + y*y);
	}
	
	@Override
	public String toString() 
	{
		return "(" + String.valueOf(x) + "," + String.valueOf(y) + ")";
	}
}